# 1)赋值运算符案例
num1 = 10
i = 100
i += 100  # =>i=i+ 100
print("i=", i)  # 200
i -= 100  # =>i=i-100
print("i=", i)  # 100
i = i * 3  # i *= 3
print("i=", i)

# 交换两个变量的值
a = 30
b = 40

"""
1.先定义一个中间变量temp
2.temp =a #先把a的值保存到temp
3.a=b#把b的值赋给a
4.b= temp #把temp(即a)的值赋给b
"""
print("交换前a=", a, "b=", b)
temp = a
a = b
b = temp
print("交换后a=", a, "b=", b)

print("------------------------------")
# python中支持一种简单的交换变量值的方法
print("交换前a=", a, "b=", b)
a, b = b, a
print("交换后a=", a, "b=", b)